package com.itlong.cloud.commons.chinapay.resource;

import com.itlong.cloud.commons.chinapay.service.IChinaPayTransferAccountService;
import com.itlong.cloud.paymenthub.IChinaPayTransferAccountServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * <desc>
 * 银联转账-服务暴露接口实现类.
 * </desc>
 *
 * @createDate 2018/9/1
 */
@RestController
public class ChinaPayTransferAccountServiceResource implements IChinaPayTransferAccountServiceClient {

    @Autowired
    private IChinaPayTransferAccountService iChinaPayTransferAccountService;

    /**
     * <desc>
     *      根据项目编号和金额向物业公司转账
     * <desc/>
     *
     * @param cashIds 提现记录ID,逗号分隔
     * @return
     * @author Juguang.S
     * @createDate 2018-09-01
     */
    @Override
    @PostMapping(path = "/pay/transferAccount")
    public void transferAccount(@RequestParam("cashIds") String cashIds,@RequestParam("myUserName") String myUserName) throws Exception {
        iChinaPayTransferAccountService.transferAccount(cashIds,myUserName);
    }

    /**
     * <desc>
     *      查询将要转账的总金额
     * <desc/>
     *
     * @param cashIds 提现记录ID,逗号分隔
     * @return
     * @author Juguang.S
     * @createDate 2018-09-23
     */
    @Override
    @PostMapping(path = "/pay/getTotal")
    public String getTotal(@RequestParam("cashIds") String cashIds) {
        return iChinaPayTransferAccountService.getTotal(cashIds);
    }
    /**
     * <desc>
     *      查询将要转账的总金额
     * <desc/>
     *
     * @return
     * @author Juguang.S
     * @createDate 2018-09-23
     */
    @Override
    @PostMapping(path = "/pay/getAccountBalance")
    public String getAccountBalance() throws Exception{
        return iChinaPayTransferAccountService.getAccountBalance();
    }

    /**
     * <desc>
     *      查询银联交易结果状态
     * <desc/>
     *
     * @return
     * @author Juguang.S
     * @createDate 2018-09-25
     */
    @Override
    @PostMapping(path = "/pay/getTradeStatus")
    public void timeTaskGetOrderStatus() throws Exception {
        iChinaPayTransferAccountService.getTradeStatus();
    }

    /**
     * <desc>
     *      获取银联的手续费
     * <desc/>
     *
     * @return
     * @author Juguang.S
     * @createDate 2018-10-10
     */
    @Override
    @PostMapping(path = "/pay/getChinaPayHandFee")
    public String getChinaPayHandFee() {
        return iChinaPayTransferAccountService.getChinaPayHandFee();
    }

}
